# 8.6
def city_country(name, country):
    city = f'{name}, {country}'
    return city.title()
# ⾄少使⽤三个城市⾄国家对调⽤这个函数，并打印它返回的值。
print(city_country('wuhan', 'china'))

# 8.7
def make_album(singer_name, album_name):
    album = {'singer_name': singer_name, 'album_name': album_name}
    return album
print(make_album(1, 2))
print(make_album(2, 3))
print(make_album(3, 4))
'''
给 make_album() 函数添加⼀个默认值为 None 的可选形参，以便存
储专辑包含的歌曲数。如果调⽤这个函数时指定了歌曲数，就将这个
值添加到表⽰专辑的字典中。调⽤这个函数，并⾄少在⼀次调⽤中指
定专辑包含的歌曲数。
'''
def make_album(singer_name, album_name, song_number=None):
    if song_number:
        album = {'singer_name': singer_name, 'album_name': album_name, 'song_number': song_number}
    else:
        album = {'singer_name': singer_name, 'album_name': album_name}
    return album
print(make_album(1, 2, 5))
print(make_album(2, 3))

# 8.8
def make_album(singer_name, album_name, song_number=None):
    if song_number:
        album = {'singer_name': singer_name, 'album_name': album_name, 'song_number': song_number}
    else:
        album = {'singer_name': singer_name, 'album_name': album_name}
    return album
while True:
    print("\nPlease tell me your favorite album:")
    print("(enter 'q' at any time to quit)")
    s_name = input("who is the album singer:")
    if s_name == 'q':
        break
    a_name = input("what is the album name?")
    if a_name == 'q':
        break
    print(make_album(s_name, a_name))